import {
  listReq
} from "@/api/authority_app/base";
// 改变弹窗表单 defaultAttr 结构中某个属性
export function changeAttrByPropGlobal(list, prop, nodeName, attriName, value) {
  let indexlist = list.map((item) => {
    return item.prop;
  });
  let index = indexlist.indexOf(prop);
  let item = list[index];
  this.$set(item[nodeName], attriName, value);
};
// 获取当前登录信息
export async function getUserInfoGlobal(queryUrl) {
  let mode = "result"
  let result = [];
  if (mode === "data" || !mode) {
    await listReq(queryUrl, null).then((res) => {
      result = res.result.data;
    });
  }
  if (mode === "result") {
    await listReq(queryUrl, null).then((res) => {
      result = Array(res.result);
    });
  }
  result = result[0];
  return result;
};
